package unit2;


public class Ex2_24_StringTest {
    public static void main(String[] args) {
        String mystring = "How do you do.";
        int lfirstpos1 = mystring.indexOf('o');
        int rfirstpos1 = mystring.lastIndexOf('o');
        System.out.println(lfirstpos1 + "  " + rfirstpos1);
        int lfirstpos2 = mystring.indexOf("do");
        int rfirstpos2 = mystring.lastIndexOf("do");
        System.out.println(lfirstpos2 + "  " + rfirstpos2);
        int lfirstpos3 = mystring.indexOf('o', 3);
        int rfirstpos3 = mystring.lastIndexOf('o', 10);
        System.out.println(lfirstpos3 + "  " + rfirstpos3);
        int lfirstpos4 = mystring.indexOf("do", 6);
        int rfirstpos4 = mystring.lastIndexOf("do", 10);
        System.out.println(lfirstpos4 + "  " + rfirstpos4);
    }
}
